package com.aidex.biz.service.impl;

import com.aidex.biz.domain.CustomerFile;
import com.aidex.biz.mapper.CustomerFileMapper;
import com.aidex.biz.service.CustomerFileService;
import com.aidex.common.annotation.DataScope;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.utils.NumberUtils;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 客户附件Service业务层处理
 * @author sean
 * @email 2074844820@qq.com
 * @date 2023-11-28
 */
@Service
@Transactional(readOnly = true)
public class CustomerFileServiceImpl extends BaseServiceImpl<CustomerFileMapper, CustomerFile> implements CustomerFileService
{
    private static final Logger log = LoggerFactory.getLogger(CustomerFileServiceImpl.class);

    /**
     * 获取单条数据
     * @param customerFile 客户附件
     * @return 客户附件
     */
    @Override
    public CustomerFile get(CustomerFile customerFile)
    {
        CustomerFile dto = super.get(customerFile);
        return dto;
    }

    /**
     * 获取单条数据
     * @param id 客户附件id
     * @return 客户附件
     */
    @Override
    public CustomerFile get(String id)
    {
        CustomerFile dto = super.get(id);
        return dto;
    }


    /**
     * 查询客户附件列表
     * @param customerFile 客户附件
     * @return 客户附件
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public List<CustomerFile> findList(CustomerFile customerFile)
    {
        return super.findList(customerFile);
    }

    /**
     * 分页查询客户附件列表
     * @param customerFile 客户附件
     * @return 客户附件
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public PageInfo<CustomerFile> findPage(CustomerFile customerFile)
    {
        return super.findPage(customerFile);
    }

    /**
     * 保存客户附件
     * @param customerFile
     * @return 结果
     */
    @Override
    public boolean save(CustomerFile customerFile)
    {
        return super.save(customerFile);
    }


    /**
     * 删除客户附件信息
     * @param customerFile
     * @return 结果
     */
    @Override
    public boolean remove(CustomerFile customerFile)
    {
        return super.remove(customerFile);
    }

    /**
     * 批量删除客户附件
     * @param ids 需要删除的客户附件ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteCustomerFileByIds(String[] ids)
    {
        return mapper.deleteCustomerFileByIds(ids);
    }

    /**
     * 获取最大编号
     * @param customerFile 客户附件
     * @return 结果
     */
    @Override
    public int findMaxSort(CustomerFile customerFile)
    {
        return NumberUtils.nextOrder(mapper.findMaxSort(customerFile));
    }
}
